﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AMS.LCM.Controllers;

namespace AMS.LCM
{
    public partial class LCMForm : Form
    {
        LCMController _controller;

        public string Integer
        {
            get { return txtInteger.Text; }
            set { txtInteger.Text = value; }
        }

        public string Result
        {
            get { return txtResult.Text; }
            set { txtResult.Text = value; }
        }

        public LCMForm(LCMController controller)
        {
            InitializeComponent();
            this._controller = controller;
            _controller.LCMCalculated += new EventHandler<LCMEventArgs>(HandleLCMCalculated);
        }

        private void btnCalculate_Click(object sender, EventArgs e)
        {
            _controller.CalculateLCM();
        }

        private void HandleLCMCalculated(object sender, LCMEventArgs args)
        {
            this.Result = args.LCM.ToString();
        }
    }
}
